faces = [{'faceId': 'b936fe59-ffba-4f4b-9f22-313ef1fcedb0',
  'faceRectangle': {'top': 69, 'left': 460, 'width': 211, 'height': 211},
  'faceAttributes': {'smile': 0.001,
   'headPose': {'pitch': -2.9, 'roll': -3.9, 'yaw': -10.6},
   'gender': 'female',
   'age': 22.0,
   'facialHair': {'moustache': 0.0, 'beard': 0.0, 'sideburns': 0.0},
   'glasses': 'NoGlasses',
   'emotion': {'anger': 0.0,
    'contempt': 0.011,
    'disgust': 0.0,
    'fear': 0.0,
    'happiness': 0.001,
    'neutral': 0.977,
    'sadness': 0.01,
    'surprise': 0.001},
   'hair': {'bald': 0.02,
    'invisible': False,
    'hairColor': [{'color': 'brown', 'confidence': 0.98},
     {'color': 'black', 'confidence': 0.98},
     {'color': 'other', 'confidence': 0.18},
     {'color': 'gray', 'confidence': 0.15},
     {'color': 'red', 'confidence': 0.11},
     {'color': 'blond', 'confidence': 0.06},
     {'color': 'white', 'confidence': 0.0}]}}},
{'faceId': '8e877c7c-2784-48fd-b965-51be6438a4be',
  'faceRectangle': {'top': 114, 'left': 306, 'width': 184, 'height': 184},
  'faceAttributes': {'smile': 1.0,
   'headPose': {'pitch': -2.5, 'roll': -4.4, 'yaw': 5.5},
   'gender': 'female',
   'age': 21.0,
   'facialHair': {'moustache': 0.0, 'beard': 0.0, 'sideburns': 0.0},
   'glasses': 'NoGlasses',
   'emotion': {'anger': 0.0,
    'contempt': 0.0,
    'disgust': 0.0,
    'fear': 0.0,
    'happiness': 1.0,
    'neutral': 0.0,
    'sadness': 0.0,
    'surprise': 0.0},
   'hair': {'bald': 0.22,
    'invisible': False,
    'hairColor': [{'color': 'black', 'confidence': 0.99},
     {'color': 'brown', 'confidence': 0.95},
     {'color': 'gray', 'confidence': 0.24},
     {'color': 'other', 'confidence': 0.23},
     {'color': 'blond', 'confidence': 0.06},
     {'color': 'red', 'confidence': 0.04},
     {'color': 'white', 'confidence': 0.0}]}}},
{'faceId': 'fb464384-bbb2-4679-bc9a-708801550c4e',
  'faceRectangle': {'top': 211, 'left': 141, 'width': 135, 'height': 135},
  'faceAttributes': {'smile': 0.008,
   'headPose': {'pitch': -13.4, 'roll': -22.1, 'yaw': -11.2},
   'gender': 'female',
   'age': 21.0,
   'facialHair': {'moustache': 0.0, 'beard': 0.0, 'sideburns': 0.0},
   'glasses': 'NoGlasses',
   'emotion': {'anger': 0.0,
    'contempt': 0.002,
    'disgust': 0.0,
    'fear': 0.0,
    'happiness': 0.008,
    'neutral': 0.986,
    'sadness': 0.003,
    'surprise': 0.0},
   'hair': {'bald': 0.01,
    'invisible': False,
    'hairColor': [{'color': 'black', 'confidence': 1.0},
     {'color': 'brown', 'confidence': 0.89},
     {'color': 'gray', 'confidence': 0.52},
     {'color': 'other', 'confidence': 0.35},
     {'color': 'red', 'confidence': 0.03},
     {'color': 'blond', 'confidence': 0.03},
     {'color': 'white', 'confidence': 0.0}]}}}
]

# 创建字典
glasses = {}
smile = {}
hairColor = {}
age = {}
gender = {}

# 将人脸信息加入字典
count = 0
while count < len(faces):
    glasses["Person{}".format(count + 1)] = faces[count]['faceAttributes']['glasses']
    smile["Person{}".format(count + 1)] = faces[count]['faceAttributes']['smile']
    hairColor["Person{}".format(count + 1)] = faces[count]['faceAttributes']['hair']['hairColor'][0]['color']
    age["Person{}".format(count + 1)] = faces[count]['faceAttributes']['age']
    gender["Person{}".format(count + 1)] = faces[count]['faceAttributes']['gender']
    count += 1

# 打印
print("眼镜：", glasses)
print("微笑指数：", smile)
print("头发颜色：", hairColor)
print("年龄：", age)
print("性别：", gender)

#运行结果眼镜：
# {'Person1': 'NoGlasses', 'Person2': 'NoGlasses', 'Person3': 'NoGlasses'}
#眼镜： {'Person1': 'NoGlasses', 'Person2': 'NoGlasses', 'Person3': 'NoGlasses'}
#微笑指数： {'Person1': 0.001, 'Person2': 1.0, 'Person3': 0.008}
#头发颜色： {'Person1': 'brown', 'Person2': 'black', 'Person3': 'black'}
#年龄： {'Person1': 22.0, 'Person2': 21.0, 'Person3': 21.0}
#性别： {'Person1': 'female', 'Person2': 'female', 'Person3': 'female'}
